save/restore: If ENABLE_LOGDIRTY fails, it may be because it is
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Tue, 1 May 2007 09:16:26 +0000 (10:16 +0100)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Tue, 1 May 2007 09:16:26 +0000 (10:16 +0100)
already active. To find out, attempt to disable and then reenable the
mode.

Signed-off-by: Brendan Cully <brendan@cs.ubc.ca>
tools/libxc/xc_domain_save.c

index 49fd25b9b66952c24d1bcfe21cb9975376d2a2d3..32002e001732c190ec7161f20e0b52d8b740d6a2 100644 (file)
@@ -880,8 +880,17 @@ int xc_domain_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
                                XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY,
                                NULL, 0, NULL, 0, NULL) < 0 )
         {
-            ERROR("Couldn't enable shadow mode");
-            goto out;
+            /* log-dirty already enabled? There's no test op,
+               so attempt to disable then reenable it */
+            if ( !(xc_shadow_control(xc_handle, dom, XEN_DOMCTL_SHADOW_OP_OFF,
+                                     NULL, 0, NULL, 0, NULL) >= 0 &&
+                   xc_shadow_control(xc_handle, dom,
+                                     XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY,
+                                     NULL, 0, NULL, 0, NULL) >= 0) )
+            {
+                ERROR("Couldn't enable shadow mode");
+                goto out;
+            }
         }
 
         if ( hvm )